Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse FSSpecTarget Auth Credentials #668

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

ranchodeluxe
Copy link
Contributor

@ranchodeluxe ranchodeluxe commented Jan 17, 2024

Addresses #666

Goal was to remove storage options from being passed in WriteCombinedReference b/c we already had access to the target_root being dep injected. But then for all nested fsspec instantiations within WriteCombinedReference we had to figure out how to return the original fsspec options from target_root and pass them along

Companion PR in Runner

pangeo-forge/pangeo-forge-runner#163

Release Steps

@ranchodeluxe ranchodeluxe changed the title hack Do not Resuse FSSpecTarget Auth Credentials Jan 17, 2024
@ranchodeluxe ranchodeluxe marked this pull request as draft January 17, 2024 15:24
@ranchodeluxe ranchodeluxe changed the title Do not Resuse FSSpecTarget Auth Credentials Do Not Resuse FSSpecTarget Auth Credentials Jan 17, 2024
@ranchodeluxe ranchodeluxe marked this pull request as ready for review January 17, 2024 15:38
@ranchodeluxe ranchodeluxe marked this pull request as draft January 17, 2024 16:41
@ranchodeluxe ranchodeluxe changed the title Do Not Resuse FSSpecTarget Auth Credentials Reuse FSSpecTarget Auth Credentials In Dep Injection Workflows Jan 17, 2024
@ranchodeluxe ranchodeluxe force-pushed the gcorradini/add_back_context_manager branch from e86ee27 to 599359f Compare January 17, 2024 19:33
@ranchodeluxe ranchodeluxe marked this pull request as ready for review January 17, 2024 19:48
@ranchodeluxe ranchodeluxe added the test-integration Apply this label to run integration tests on a PR. label Jan 17, 2024
@ranchodeluxe ranchodeluxe changed the title Reuse FSSpecTarget Auth Credentials In Dep Injection Workflows [WIP]: Reuse FSSpecTarget Auth Credentials Jan 18, 2024
@ranchodeluxe ranchodeluxe changed the title [WIP]: Reuse FSSpecTarget Auth Credentials Reuse FSSpecTarget Auth Credentials Jan 18, 2024
@@ -65,7 +65,7 @@ class CombineMultiZarrToZarr(beam.CombineFn):
along a dimension that does not exist in the individual inputs. In this latter
case, precombining adds the additional dimension to the input so that its
dimensionality will match that of the accumulator.
:param storage_options: Storage options dict to pass to the MultiZarrToZarr
:param target_options: Storage options dict to pass to the MultiZarrToZarr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring following target_options still reads Storage options.

elif isinstance(fsspec_protocol, list):
return fsspec_protocol[0]
else:
raise ValueError("could not resolve fsspec protocol from underlying filesystem")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could return what fsspec_protocol is in the ValueError if it isn't caught by any of the isinstance checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@@ -466,9 +465,6 @@ class WriteReference(beam.PTransform, ZarrWriterMixin):
will be appended to this prefix to create a full path.
:param output_file_name: Name to give the output references file
(``.json`` or ``.parquet`` suffix).
:param target_options: Storage options for opening target files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So nice to get rid of all of these

@@ -46,14 +46,14 @@ def test_xarray_zarr(
| beam.Create(pattern.items())
| OpenWithXarray(file_type=pattern.file_type)
| StoreToZarr(
target_root=tmp_target_url,
target_root=tmp_target,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad this works!

Copy link
Contributor

@norlandrhagen norlandrhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @ranchodeluxe! Nice to remove all of the super nested fsspec stuff being passed around. Left a few minor comments.

@ranchodeluxe ranchodeluxe force-pushed the gcorradini/add_back_context_manager branch from a94d527 to 6979092 Compare January 25, 2024 19:20
@ranchodeluxe
Copy link
Contributor Author

@cisaacstern: gonna merge this since we talked about getting our kerchunk recipes squared away today

@ranchodeluxe ranchodeluxe merged commit e7ffdb8 into main Jan 25, 2024
9 checks passed
@ranchodeluxe ranchodeluxe deleted the gcorradini/add_back_context_manager branch January 25, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-integration Apply this label to run integration tests on a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants